#include <iostream>
#define MAXN 2000000001
using namespace std;

int N, prime[MAXN];
void solve();

// 两个质数的成绩是合数, 即它也是质数, 它的因数也是质数
int main() {
    cin >> N;
    solve();
}


// 可能会爆掉
/*
bool is_prime(int x) {
    if (x == 2) return true;
    for (int i = 2; i * i < x; i++) {
        if (x % i == 0) return false;
    }
    return true;
}

void solve() {
    int res = 0;
    for (int i = 2; i < N; i++) {
        if (is_prime(i) && N % i == 0 && is_prime(N / i)) {
            res = max(i, N / i);
            cout << res << endl;
            return;
        }
    }
}
*/

void seive(int n) {
    for (int i = 0; i <= n; i++) prime[i] = true;
    prime[0] = prime[1] = false;
    for (int i = 2; i <= n; i++) {
        if (prime[i]) {
            for (int j = 2 * i; j <= n; j += i) prime[j] = false;
        }
    }
}

void solve() {
    seive(N); int res = 0;
    for (int i = 2; i < N; i++) {
        if (prime[i] && N % i == 0 && prime[N / i]) {
            res = max(i, N / i);
            cout << res;
            return;
        }
    }
}

